package promis.db.connection;

import java.io.IOException;
import promis.utility.CommonService;
import com.tis.utilitys.PropertiesUtility;

public class Userinfo {
	
		//private static String url = "jdbc:oracle:thin:@ACER4741G:1521:ACERDB"; //"jdbc:oracle:thin:@192.168.2.50:1521:orcl";				
		//private static String url = "jdbc:oracle:thin:@192.168.2.50:1521:DEVDB1";
		//private static String url = "jdbc:oracle:thin:@192.168.2.46:1521:SPLDB";
		//private static String url = "jdbc:oracle:thin:@192.168.100.206:1521:ORCL";
		//private static String url = "jdbc:oracle:thin:@192.168.2.50:1521:UATDB2";
		//private static String url = "jdbc:oracle:thin:@58.137.190.212:1521:SPLDB";
	    //private static String user = "SYNCHRO";				//"SPL";
	    //private static String passwd = "synchro";			//"Tistis";
	    //private static boolean autoCommit = true;
	    //private static int loginTimeout = 28800;
	    
		/**
		 * @return the url
		 * @throws Exception 
		 * @throws IOException 
		 */
		public static String getUrl() {
			try {
				return new PropertiesUtility().GetConfigDBValue("db.url");
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return "";
		}
		
		/**
		 * @return the user
		 */
		public static String getUser() {
			try {
				return new PropertiesUtility().GetConfigDBValue("db.username");
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return "";
		}
		/**
		 * @return the passwd
		 */
		public static String getPasswd() {
			try {
				return new PropertiesUtility().GetConfigDBValue("db.password");
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return "";
		}
		/**
		 * @return the autoCommit
		 */
		public static boolean getAutoCommit() {
			boolean autoCommit = true; 
			try {				
				
				if(CommonService.IsNullRString(new PropertiesUtility().GetConfigDBValue("db.autoCommit")).equals("true"))
					autoCommit = true;
				else 
					autoCommit = false;
				
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return autoCommit;
		}
		/**
		 * @return the loginTimeout
		 */
		public static int getLoginTimeout() {
			try {
				
				return CommonService.ConvertStringToBigDecimal(new PropertiesUtility().GetConfigDBValue("db.loginTimeout")).intValue();
				
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return 60;
		}
}
